package com.sgb.capital.view.ui.adapter;

import android.content.Context;

import com.sgb.capital.BR;
import com.sgb.capital.R;
import com.sgb.capital.base.BaseRecycleAdapter;
import com.sgb.capital.model.TransferBean;
import com.sgb.capital.utils.ItemViewHolder;
import com.sgb.capital.utils.Utils;

import java.util.List;

/**
 * 作者:张磊
 * 日期:2021/10/11 0011
 * 说明:在线转账item
 */
public class TransferAccountsAdapter extends BaseRecycleAdapter<TransferBean.ListDTO> {

    public TransferAccountsAdapter(Context context, List<TransferBean.ListDTO> datas) {
        super(context, R.layout.transferaccounts_adapter, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, TransferBean.ListDTO item) {
        holder.setBinding(BR.viewModel, item);
        holder
                .setText(R.id.tv_money, "¥" + Utils.getDecimalFormat(item.transferMoney))
                .setText(R.id.tv_order_num, item.orderId)
                .setText(R.id.tv_time, Utils.getTime(item.created))
                .setText(R.id.tv_type,
                        item.method.contains("BALANCE") ? "余额支付" :
                                item.method.contains("WX") ? "微信支付" :
                                        item.method.contains("AL") ? "支付宝支付" : "B2B网银")
                .setText(R.id.tv_state, item.payApplyState == 0 ? "/" : item.payApplyState == 1 ? "审批中" : item.payApplyState == 2 ? "已通过" : "已拒绝")
                .setText(R.id.tv_result, item.transferResult == 0 ? "未付款" : item.transferResult == 1 ? "转账成功" : "转账失败");
    }
}
